﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Input variable</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body>
<P><FONT color=#0000ff><FONT 
face=Verdana color=#000000><STRONG>How 
to do Input in Python?</STRONG></FONT> </FONT></P><FONT face=Courier><FONT color=#800000><FONT 
color=#000000>
<P class=MsoNormal 
style="BACKGROUND: #f5f5ff; MARGIN: 0in 0in 10pt; LINE-HEIGHT: 12.65pt; mso-margin-bottom-alt: auto"><SPAN 
style="FONT-SIZE: 10pt; COLOR: #880000; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"># raw_input() reads every input as a string<BR># then it's up to you to process the string
<BR></SPAN>
<SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">
str1 

</SPAN>
<SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">=</SPAN>
<SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> raw_input</SPAN>
<SPAN style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">

(</SPAN>

<SPAN 
style="FONT-SIZE: 10pt; COLOR: #008800; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">"Enter anything:"</SPAN><SPAN style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> 
) <BR> </SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #000088; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">print</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> </SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #008800; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">"raw_input ="</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">,</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> str1<BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #880000; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"><BR># input() actually uses 
raw_input() and then tries to<BR># convert the input data 
to a number using eval()<BR># hence you could enter a math 
expression<BR># gives an error if input is not numeric eg. 
$34.95<BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">x </SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">=</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> input</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">(</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #008800; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">"Enter a number:"</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">)<BR></SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #000088; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">print</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> </SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #008800; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">"input ="</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: #666600; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'">,</SPAN><SPAN 
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Consolas; mso-bidi-font-size: 11.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Courier New'"> x</SPAN></P></FONT></FONT></FONT></body>
</html>
